#pragma once
#include <Windows.h>
#include <vector>
#include <map>
#include <algorithm>

struct VEHHOOK
{
    ULONG_PTR lpSrcFunc;
    ULONG_PTR lpNewFunc;
    BYTE OpCode;

    VEHHOOK(IN ULONG_PTR Src, IN ULONG_PTR New)
    {
        lpSrcFunc = Src;
        lpNewFunc = New;
    }
};
using PVEHHOOK = VEHHOOK*;

class CVehHook
{
private:
    PVOID m_lpVeh;
    static std::map<ULONG_PTR, PVEHHOOK> m_VehHookMap;

public:
    CVehHook();
    ~CVehHook();

protected:
    static LONG NTAPI VectoredExceptionHandler(IN PEXCEPTION_POINTERS lpExceptionPointers);

public:
    BOOL AddVehHook(IN ULONG_PTR SrcFunc, IN ULONG_PTR NewFunc);
    BOOL Remove(IN ULONG_PTR SrcFunc);
    void RemoveAll();
};

